﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Minecraft.Config
{
	public class JsonConfig
	{
		public static Rootobject Value
		{
			get
			{
#if DEBUG //（Debug，不使用，只用来做模板）
				var jsonConfigFileName = "config_Debug";
#elif DEB_YZZ //本地测试(yzz)
				var jsonConfigFileName = "config_Deb_Yzz";
#elif DEB_ZSS //本地测试(zss)
				var jsonConfigFileName = "config_Deb_Zss";
#elif LAN_YZZ //windows局域网测试(yzz)
				var jsonConfigFileName = "config_LAN_Yzz";
#elif LAN_ZSS //windows局域网测试(zss)
				var jsonConfigFileName = "config_LAN_Zss";
#elif SVNSERVER //SVN服务器局域网测试
				var jsonConfigFileName = "config_SVNServer";
#else //（Release，不使用，只用来做模板）
				var jsonConfigFileName = "config_Release";
#endif
				string fileContent = File.ReadAllText(Path.Combine("jsonConfig", jsonConfigFileName + ".json"));
				var str = Regex.Replace(fileContent, @"/\*[\s|\S]*?\*/", "");
				return str.JsonDeserialize<Rootobject>();
			}
		}
	}
}
